/*
listmult([],X,0).
listmult([H|T],X,N) :- N >0, H = X, N2 is N -1,listmult(T,X,N2).

zerosquare(X,SX,SY) :- listmult(Row,0,SX), listmult(X,Row,SY).

getn([H|T],0,X) :- X is H.
getn([H|T],N,X) :- N2 is N-1, getn(T,N2,X).

getxy(List,X,Y, Res) :- getn(List,Y,Row), getn(Row,X,Res).
*/

range([],0).
range([H|T],N) :- H is N, N2 is N-1, range(T,N2).

in3(X) :- range(R,9),!, member(X,R).

p(A,B,C) :- in3(A), in3(B), in3(C), 9 is A+B+C.
